package com.xuelangyun.job;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Version 1.0
 * @Author:xinyan
 * @Date:2022/4/17
 * @Content:
 */
@Component
public class TaskJob01 {
    @Scheduled(cron = "0/2 * * * * ?")
    public void job1() {
        System.out.println("任务 1:" +
                new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(new Date()));
    }
    @Scheduled(cron = "0/7 * * * * ?")
    public void job2() {
        System.out.println("任务 2:" + new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(new Date()));
    }
}
